    //
//  UIView+HUD.m
//  TRProject
//
//  Created by xkl on 16/2/26.
//  Copyright © 2016年 Aaron. All rights reserved.
//

#import "UIView+HUD.h"
//超"MBProgressHUD.h"Out  30
//弹出提示时长
#define kDuration
@implementation UIView (HUD)
- (void)showBusyHUD{
    dispatch_async(dispatch_get_main_queue(), ^{
        //[MBProgressHUD hideAllHUDsForView:self animated:YES];
        MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self animated:YES];
        hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
        hud.contentColor = UIColor.whiteColor;
        hud.bezelView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];

        //        [hud hideAnimated:YES afterDelay:kDuration];
//        [hud hide:YES];
        [hud showAnimated:YES];
       
    });
}
- (void)showWarning:(NSString *)warning{
    if(warning.length > 0){
        dispatch_async(dispatch_get_main_queue(), ^{
            //[MBProgressHUD hideAllHUDsForView:self animated:YES];
            MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self animated:YES];
            hud.bezelView.style = MBProgressHUDBackgroundStyleSolidColor;
            hud.bezelView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.8];
            hud.mode = MBProgressHUDModeText;
    //        hud.labelText = warning;
            hud.minShowTime = 2;
            hud.detailsLabel.text = warning;
            hud.detailsLabel.font = [UIFont systemFontOfSize:14];
            hud.detailsLabel.textColor = UIColor.whiteColor;
    //        [hud hideAnimated:YES afterDelay:kDuration];
            [hud hideAnimated:YES];
        });
    }
}
- (void)hideBusyHUD{
    dispatch_async(dispatch_get_main_queue(), ^{
        [MBProgressHUD hideHUDForView:self animated:YES];
        
    });
}
@end










